﻿function saveCustomer() {

    
    var customer=new Object();
    customer.CustomerId = 0;
    customer.CustomerName = $("[id$='txtCustomerName']").val();
    customer.City_ID = $("[id$='hdnCityId']").val();
    customer.Address = $("[id$='txtAddress']").val();
    customer.ContactPerson = $("[id$='txtContactPerson']").val();
    customer.PhoneNo = $("[id$='txtPhoneNo']").val();
    customer.CellNo = $("[id$='txtCellNo']").val();
    customer.CustomerType = $("[id$='ddlType'").val();
    $.ajax({
        url: "/Parties/AddEditCustomer.aspx/SaveCustomer",
        type: "POST",
        dataType: "json",
        data: JSON.stringify({ Customer: customer }),
        contentType: "application/json; charset=utf-8"
    }).done(function (data) {
        showSuccessMsg("Data Saved Successfully!!!!!");
        $("#divCustomerWrapper").find("input[type=text]").val("");
        $("#divCustomerWrapper").find("textarea").val("");
        $("#divCustomerWrapper").find("select").val("");
    });
}